package servlet;

public class HttpProtocolUtil {

    public static String getResponseHeader200(Integer contextLength){
        // \r\n 回车符换行，为了后续拼接参数

        return "HTTP/1.1 200 OK \n"+
                "Content-type:text/html \n"+
                "Content-Length:"+contextLength+ "\n"+
                "\r\n";
    }

    public static String getResponseHeader404(){
        // \r\n 回车符换行，为了后续拼接参数
        String str404 = "<h1>404 NOT Found</h1>";
        return "HTTP/1.1 404 NOT Found \n"+
                "Content-type:text/html \n"+
                "Content-Length:"+str404.getBytes().length+ "\n"+
                "\r\n" + str404;
    }
}
